package com.liuhm.exception;


import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 异常统一处理类
 *
 * @author: liuhaomin
 * @date: 2019/2/25
 */
@RestControllerAdvice
public class JrsfControllerAdvice {

    @ExceptionHandler(value = Exception.class)
    public R error(Exception ex) {
        return R.fail().msg(ex.getMessage());
    }

    @ExceptionHandler(value = BusinessException.class)
    public R jrsfExceptionHandler(BusinessException exception) {
        return R.fail().msg(exception.getMessage());
    }
}
